package com.qd.common.panda.domain.entity.carpark;

import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Optional;

/**
 * 充电信息
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class CarParkChargeDTO extends BaseQuery {

    /**
     * 主键
     */
    @NotBlank(message = "停车场标识不能为空", groups = {DefaultGroup.class})
    @Size(max = 50, message = "停车场标识长度不能超过{max}位", groups = {DefaultGroup.class})
    @JsonProperty("pId")
    private String pId;
    /**
     * 快充总数量
     */
    private Integer fastChargeNum;
    /**
     * 快充已使用数量
     */
    private Integer fastChargeUse;
    /**
     * 慢充总数量
     */
    private Integer slowChargeNum;
    /**
     * 慢充已使用数量
     */
    private Integer slowChargeUse;
    /**
     * 免费停车
     */
    @Size(max = 20, message = "免费停车长度不能超过{max}位", groups = DefaultGroup.class)
    private String freePark;
    /**
     * 免费停车显示
     */
    private String freeParkDisplay;
    /**
     * 24小时
     */
    @Size(max = 20, message = "24小时长度不能超过{max}位", groups = DefaultGroup.class)
    private String allDay;
    /**
     * 24小时显示
     */
    private String allDayDisplay;
    /**
     * 充电品牌,0-蔚来，1-国网，2-特来电
     */
    private Integer chargeBrand;
    /**
     * 充电品牌显示
     */
    private String chargeBrandDisplay;
    /**
     * 场站ID
     */
    private String stationId;
    /**
     * 免费停车设置
     */
    private CarParkChargeFeeDTO carParkChargeFee;
    @Override
    public void freeData() {
        this.pId = null;
        this.fastChargeNum = null;
        this.fastChargeUse = null;
        this.slowChargeNum = null;
        this.slowChargeUse = null;
        this.freePark = null;
        this.freeParkDisplay = null;
        this.allDay = null;
        this.allDayDisplay = null;
        this.chargeBrand = null;
        this.chargeBrandDisplay = null;
        this.stationId = null;
        Optional.ofNullable(carParkChargeFee).ifPresent(CarParkChargeFeeDTO::freeData);
        super.freeData();
    }
}
